/**
 * Created by chenwu
 * @date  2019/12/30 11:02
 */
import React from 'react';
import BasicLayout from './BasicLayout';
import UserLayout from './UserLayout';
import ResetLayout from './ResetLayout';
import ForgetPasswordLayout from './ForgetPasswordLayout';
import ExternalLayout from './ExternalLayout';
import MapLayout from './MapLayout';

const mapPathnames = [
  '/afterSalesAnalysis/overallAnalysis',
  '/afterSalesAnalysis/inflowAnalysis',
  '/afterSalesAnalysis/outflowAnalysis',
  '/outdoorExpansion/residentSiteAnalysis',
  '/outdoorExpansion/activelyAnalyze',
  '/outdoorExpansion/workplaceAnalysis'
];

export default props => {
  const { location } = props;
  const { pathname } = location;
  if (pathname === '/user/login') {
    return <UserLayout {...props} />;
  }
  if (pathname === '/user/resetPassword') {
    return <ResetLayout {...props} />;
  }
  if (pathname === '/user/forgetPassword') {
    return <ForgetPasswordLayout {...props} />;
  }
  if (mapPathnames.includes(pathname)) {
    return <MapLayout {...props} />;
  }
  if (pathname.startsWith('/external/')) {
    return <ExternalLayout {...props} />;
  }
  return <BasicLayout {...props} />;
};
